const {Service} = require('egg');

class UserService extends Service{
    async getList(startIndex,limit){
        return await this.app.mysql.query(`select * from userlist limit ${startIndex},${limit}`);
    }

    //查此人是否存在
    async selectUser(idcard){
        return await this.app.mysql.query('select * from userlist where idcard=?',[idcard])
    }

    async add(username,password,idcard,address,phone,sex,create_time){
        await this.app.mysql.query('insert into userlist (username,password,idcard,address,phone,sex,create_time) values (?,?,?,?,?,?,?)',[username,password,idcard,address,phone,sex,create_time])
    }
}

module.exports = UserService